feat(canvas): web analytics template + date-range picker#2657
Merged
Conversation
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/core/src/canvas/dashboardQueryService.test.ts:29-108
**Non-parameterised shape tests**
The six happy-path shape cases (`scalar`, `column`, `labels`, `matrix`, `pairs`, `retention`) share the same fixture → run → `toMatchObject` structure and could be collapsed into a single `it.each` table. The two failure tests (lines 82-101) also share `expect(r.ok).toBe(false)` and are a natural second table. Keeping them as individual `it` blocks violates the project's "always prefer parameterised tests" convention and makes the list harder to extend when new shapes are added.
### Issue 2 of 2
packages/ui/src/features/canvas/components/ChannelsList.tsx:58-62
Closed channels write `"0"` to `localStorage`, but the comment above `useChannelOpen` says "only an explicit open is stored." The `"0"` entries are redundant because absent keys are also read as `false`; over many channels they accumulate needless storage entries. Remove the `"0"` write (or remove the stored key entirely on close) to match the documented intent.
```suggestion
try {
if (next) {
localStorage.setItem(key, "1");
} else {
localStorage.removeItem(key);
}
} catch {
// Ignore storage failures (private mode, quota) — state still works in-session.
}
```
Reviews (1): Last reviewed commit: "feat(canvas): web analytics template + d..." | Re-trigger Greptile |
Canvas template system (Dashboard / Web analytics / Blank) with a create
picker, per-template agent prompts + component allow-lists, rename, the
Quill component pass, and the showcase seed — plus the Web analytics
template and its date-range picker.
- Templates: canvasTemplates + templateSchemas + CanvasTemplatesService,
templateId on canvas records, NewCanvasMenu picker, per-template chat
suggestions.
- Web analytics template: KPI row, visitor trends with prior-period
comparison, sources, geography, retention, active hours.
- New catalog components: Heatmap and RetentionGrid.
- DateTimePicker in the toolbar (quill): named ranges roll to now, Custom
pins to absolute; view re-runs queries, edit feeds the agent via a
[Range] prompt line.
- Multi-value query refresh: shape-tagged queries mapped onto props via a
JSON-pointer setter; timezone-safe {date_from}/{date_to}(+_prev) tokens.
- Channels remember collapsed state in localStorage (closed by default).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
75f4d8f to
b9a5559
Compare
|
React Doctor found 2 issues in 2 files · 2 warnings. 2 warnings
Reviewed by React Doctor for commit |
- Parameterize dashboardQueryService shape-mapping tests via it.each - Remove redundant "0" localStorage writes for closed channels Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
raquelmsmith
approved these changes
Jun 15, 2026
raquelmsmith
left a comment
Member
There was a problem hiding this comment.
stuff to fine-tune here, assuming you'll do that later?
| id: "web-analytics", | ||
| name: "Web analytics", | ||
| description: | ||
| "A PostHog-style web analytics board: KPI row, visitor trends, sources, geography, retention and active hours — all driven by a date range.", |
Member
There was a problem hiding this comment.
Suggested change
| "A PostHog-style web analytics board: KPI row, visitor trends, sources, geography, retention and active hours — all driven by a date range.", | |
| "A dashboard for web analytics: KPI row, visitor trends, sources, geography, retention and active hours, filterable by date range.", |
Comment on lines
+110
to
+131
| const BLANK_SUGGESTIONS: CanvasSuggestion[] = [ | ||
| { | ||
| label: "Landing page", | ||
| prompt: | ||
| "Build a marketing landing page with a hero (headline, subtitle, call to action), a grid of feature cards, and a closing section.", | ||
| }, | ||
| { | ||
| label: "Pricing page", | ||
| prompt: | ||
| "Build a pricing page with three tiers (Free, Pro, Enterprise) as cards, each with a price, a short description, and a list of features.", | ||
| }, | ||
| { | ||
| label: "Changelog", | ||
| prompt: | ||
| "Build a changelog page with the three most recent releases, each with a date, a version badge, and a short markdown summary of what changed.", | ||
| }, | ||
| { | ||
| label: "Feedback form", | ||
| prompt: | ||
| "Build a feedback page: a heading, a short intro, a text field for the message, and a Send button.", | ||
| }, | ||
| ]; |
Member
There was a problem hiding this comment.
these don't seem like great suggestions for our users' use-cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new Web analytics canvas template that drives the agent to build a PostHog-style board (KPI row, visitor trends with prior-period comparison, sources, geography, retention, active hours) for a selectable date range.
TLDR: web analytics
Highlights
Heatmap(day×hour activity) andRetentionGrid(cohort bars) — schema + bodies + registry wiring.[Range]prompt line.shape(scalar/column/labels/matrix/pairs/retention) mapped onto props via a JSON-pointer setter. Mis-shaped numeric columns fail (instead of charting zeros); identical values skip the file write (no poll churn).{date_from}/{date_to}(+_prevfor comparison series) substituted as UTC-instanttoDateTime(<unix>)literals.localStorage(closed by default).stickyHeaderwith a capped scroll viewport; Filter button disabled (not wired yet).Test plan
pnpm --filter @posthog/core test— 1415 pass (incl. newdashboardQueryServiceshape-mapping tests).pnpm typecheck(core/ui/host-router) + biome lint clean.🤖 Generated with Claude Code